using System;
using System.IO;

namespace SolarWinds.Logging
{
    internal class Log
    {
        #region Fields

        private readonly String mLogName;
        private readonly StreamWriter mLogFileStream;

        #endregion

        #region Properties

        public String LogName
        {
            get { return mLogName; }
        }

        public StreamWriter StreamWriter
        {
            get { return mLogFileStream; }
        }

        #endregion

        public Log(String logName)
        {
            mLogName = logName;

            mLogFileStream = new StreamWriter(logName + ".log");
            mLogFileStream.AutoFlush = true;
            
            WriteLine("Creating new logfile " + logName + ".log.");
        }

        public void WriteLine(String msg)
        {
            mLogFileStream.WriteLine("{0}  {1}", DateTime.Now, msg);
        }
    }
}